//      untitled.c
//      
//      Copyright 2010 Beat Michel Liechti <liecb2@ebxliecb2>
//      
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//      
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//      
//      You should have received a copy of the GNU General Public License
//      along with this program; if not, write to the Free Software
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//      MA 02110-1301, USA.


#include <stdio.h>
#include <sys/mman.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>

void static *timer_thread_function(void *customData)
{
  struct timespec a, b;
  while(1)
  {
    a.tv_sec = 0;
    a.tv_nsec = 500000;
    clock_nanosleep(CLOCK_REALTIME, 0, &a, &b);
  }
}
                    
int main(int argc, char** argv)
{
  mlockall(MCL_CURRENT | MCL_FUTURE);
  printf("starting Xenomai test app\n");
  pthread_t timerThread;
  if (pthread_create(&timerThread, NULL, timer_thread_function, NULL) != 0)
  {
    printf("ERROR: Creation of pthread failed\n");
  }
  while(1)
  {
    usleep(500);
  }
  return 0;
}                                             
                                                      